﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WhutDoomCheck.Shared.HttpModels;

namespace WhutDoomCheck.Server.Entities
{
    public class Record
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        /// <summary>
        /// 学生
        /// </summary>
        [ForeignKey(nameof(Sno))]
        public Student Student { get; set; } = null!;
        public string Sno { get; set; } = null!;

        /// <summary>
        /// 原宿舍信息
        /// </summary>
        [ForeignKey(nameof(OldDoomId))]
        public Doom? OldDoom { get; set; }
        public int? OldDoomId { get; set; }

        /// <summary>
        /// 更新后宿舍信息
        /// </summary>
        [ForeignKey(nameof(NewDoomId))]
        public Doom? NewDoom { get; set; }
        public int? NewDoomId { get; set; }

        /// <summary>
        /// 原校外住宿地址
        /// </summary>
        public string? OldAddress { get; set; }

        /// <summary>
        /// 更新后校外住宿地址
        /// </summary>
        public string? NewAddress { get; set; } 

        /// <summary>
        /// 请求发起时间
        /// </summary>
        [DatabaseGenerated(DatabaseGeneratedOption.Computed)]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public Status Status { get; set; }

        /// <summary>
        /// 备注(导员审核时的原因)
        /// </summary>
        public string Comment { get; set; } = null!;
    }
}
